import React from 'react';
import { Input, Select, DatePicker } from 'antd';
import moment from 'moment';
import { Querier } from '@/components';
import enums from '@/enums';
import { useCloudRegionOptions } from './hooks';

/**
 * 查询项（导入任务列表）
 */
function TaskListQuery(props) {
  console.log(props,'props');
  
    const cloudRegionOptions = useCloudRegionOptions();

    return (
        <Querier
            items={[
                {
                    label: '导入任务名称',
                    name: 'ossFileUploadTaskName',
                    initialValue: '',
                    children: <Input allowClear placeholder="请输入" />,
                },
                {
                    label: '云区域',
                    name: 'cloudRegionCode',
                    initialValue: undefined,
                    children: (
                        <Select
                            allowClear
                            showSearch
                            optionFilterProp="label"
                            loading={cloudRegionOptions.loading}
                            options={cloudRegionOptions.data}
                            placeholder="请选择"
                        />
                    ),
                },
                {
                    label: '状态',
                    name: 'status',
                    initialValue: undefined,
                    children: (
                        <Select
                            allowClear
                            showSearch
                            optionFilterProp="label"
                            options={enums.ossImport.taskStatus.options()}
                            placeholder="请选择"
                        />
                    ),
                },
                {
                    label: '导入时间',
                    name: 'createTime',
                    initialValue: null,
                    children: (
                        <DatePicker.RangePicker
                            style={{ height: 32 }}
                            disabledDate={(current) => current > moment().endOf('day')}
                        />
                    ),
                },
            ]}
            {...props}
        />
    );
}

export default TaskListQuery;
